//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;
using OpenLS.Drawing.Serialization;

namespace OpenLS.Drawing
{
    public class TextListStyle : IOfficeXmlSerializableAs
    {
        private TextParagraphProperties defPPr;
        private TextParagraphProperties level4pPr;
        private TextParagraphProperties level5pPr;
        private TextParagraphProperties level6pPr;
        private TextParagraphProperties level8pPr;

        private TextParagraphProperties lvl1pPr;

        private TextParagraphProperties lvl2pPr;

        private TextParagraphProperties lvl3pPr;
        private TextParagraphProperties lvl7pPr;
        private TextParagraphProperties lvl9pPr;
        private OfficeArtExtensionList _extLst;

        public TextParagraphProperties TextParagraphProperties
        {
            get { return defPPr; }
            set { defPPr = value; }
        }

        public TextParagraphProperties Level1pPr
        {
            get { return lvl1pPr; }
            set { lvl1pPr = value; }
        }

        public TextParagraphProperties Level2pPr
        {
            get { return lvl2pPr; }
            set { lvl2pPr = value; }
        }

        public TextParagraphProperties Level3pPr
        {
            get { return lvl3pPr; }
            set { lvl3pPr = value; }
        }

        public TextParagraphProperties Level4pPr
        {
            get { return level4pPr; }
            set { level4pPr = value; }
        }

        public TextParagraphProperties Level5pPr
        {
            get { return level5pPr; }
            set { level5pPr = value; }
        }

        public TextParagraphProperties Level6pPr
        {
            get { return level6pPr; }
            set { level6pPr = value; }
        }

        public TextParagraphProperties Level7pPr
        {
            get { return lvl7pPr; }
            set { lvl7pPr = value; }
        }

        public TextParagraphProperties Level8pPr
        {
            get { return level8pPr; }
            set { level8pPr = value; }
        }

        public TextParagraphProperties Level9pPr
        {
            get { return lvl9pPr; }
            set { lvl9pPr = value; }
        }

        #region IOfficeXmlSerializableAs Members

        void IOfficeXmlSerializableAs.ReadXmlAs(string name, ReadContext context)
        {
            using (var c = context.ReadAndSwitch(name, DrawingConstants.DrawingNamespaceUri, false))
            {
                TextParagraphProperties = TextParagraphProperties.ReadTextParagraphProperties("defPPr", c);
                Level1pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl1pPr", c);
                Level2pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl2pPr", c);
                Level3pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl3pPr", c);
                Level4pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl4pPr", c);
                Level5pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl5pPr", c);
                Level6pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl6pPr", c);
                Level7pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl7pPr", c);
                Level8pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl8pPr", c);
                Level9pPr = TextParagraphProperties.ReadTextParagraphProperties("lvl9pPr", c);
                _extLst = c.ReadOptionalElement<OfficeArtExtensionList>("extLst");
            }
        }

        void IOfficeXmlSerializableAs.WriteXmlAs(string name, WriteContext context)
        {
            using (WriteContext c = context.WriteAndSwitch(name, DrawingConstants.DrawingNamespace))
            {
                c.WriteOptionalElementAs(TextParagraphProperties, "defPPr");
                c.WriteOptionalElementAs(Level1pPr, "lvl1pPr");
                c.WriteOptionalElementAs(Level2pPr, "lvl2pPr");
                c.WriteOptionalElementAs(Level3pPr, "lvl3pPr");
                c.WriteOptionalElementAs(Level4pPr, "lvl4pPr");
                c.WriteOptionalElementAs(Level5pPr, "lvl5pPr");
                c.WriteOptionalElementAs(Level6pPr, "lvl6pPr");
                c.WriteOptionalElementAs(Level7pPr, "lvl7pPr");
                c.WriteOptionalElementAs(Level8pPr, "lvl8pPr");
                c.WriteOptionalElementAs(Level9pPr, "lvl9pPr");
                c.WriteOptionalElement(_extLst);
            }
        }

        #endregion
    }
}